﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NHibernate;
using Thaire.Investment.Domains.Transaction;

namespace Thaire.Investment.Repository
{
    public class FixIncomeSecuritiesTransactionRepo : BaseRepository<FixIncomeSecuritiesTransaction, int>
    {
       public FixIncomeSecuritiesTransactionRepo(ISession session)
            : base(session)
        {

         
        }

       public List<FixIncomeSecuritiesTransaction> GetListByFixIncomeIdAndPurchaseID(int fixIncomeId, int purchaseID)
       {
           return new List<FixIncomeSecuritiesTransaction>(_session.QueryOver<FixIncomeSecuritiesTransaction>()
               .Where(x => x.FixincomesecuritiesHeaderID == fixIncomeId).And (x=>x.PurchaseID == purchaseID)
               .OrderBy(x => x.CreateTs).Asc.List());
       }

       public List<FixIncomeSecuritiesTransaction> GetListByAndPurchaseID(int purchaseID)
       {
           return new List<FixIncomeSecuritiesTransaction>(_session.QueryOver<FixIncomeSecuritiesTransaction>()
               .Where(x => x.PurchaseID == purchaseID)
               .OrderBy(x => x.CreateTs).Asc.List());
       }
    
    }
}
